Skip to content

feat: Add per-feature-view metrics for online read path#365

Open
vanitabhagwat wants to merge 3 commits into
masterfrom
feat-per-fv-read-metrics
Open

feat: Add per-feature-view metrics for online read path#365
vanitabhagwat wants to merge 3 commits into
masterfrom
feat-per-fv-read-metrics

Conversation

@vanitabhagwat

@vanitabhagwat vanitabhagwat commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Emit per-feature-view latency, request count, error count, and total lookup requests on every online read in the Go feature server (HTTP + gRPC). This enables per-FV hit-rate computation in Datadog and allows filtering latency/error distributions by feature view.

Key changes:

  • Add Distribution() to StatsdClient interface
  • New FeatureViewReadMetrics emitter (fv_read_latency_ms, fv_read_requests, fv_read_errors)
  • Extend LookupMetricsAggregator with totalByFV for feature_lookup_requests
  • Extract FV names from request (works with fullFeatureNames=false)
  • New unified flag ENABLE_FV_LEVEL_METRICS (backward compatible with ENABLE_MISSING_KEY_METRICS)
  • Instrument GetOnlineFeatures and GetOnlineFeaturesRange in both HTTP and gRPC handlers

What this PR does / why we need it:

Which issue(s) this PR fixes:

Misc

vanitabhagwat and others added 2 commits June 2, 2026 22:36
…uests, errors, hit rate)

Emit per-feature-view latency, request count, error count, and total
lookup requests on every online read in the Go feature server (HTTP + gRPC).
This enables per-FV hit-rate computation in Datadog and allows filtering
latency/error distributions by feature view.

Key changes:
- Add Distribution() to StatsdClient interface
- New FeatureViewReadMetrics emitter (fv_read_latency_ms, fv_read_requests, fv_read_errors)
- Extend LookupMetricsAggregator with totalByFV for feature_lookup_requests
- Extract FV names from request (works with fullFeatureNames=false)
- New unified flag ENABLE_FV_LEVEL_METRICS (backward compat with ENABLE_MISSING_KEY_METRICS)
- Instrument GetOnlineFeatures and GetOnlineFeaturesRange in both HTTP and gRPC handlers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… emission

- Define constants for all metric names (FVReadLatencyMetric, FVReadRequestsMetric,
  FVReadErrorsMetric, LookupNotFoundMetric, LookupNullOrExpiredMetric, LookupRequestsMetric)
- Extract emitFVReadMetrics helper into server_commons.go to eliminate 4 identical
  nil-check + construct + emit patterns across HTTP and gRPC handlers
- Update tests to reference constants instead of string literals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vanitabhagwat vanitabhagwat changed the title feat: Add per-feature-view metrics for online read path (latency, req… feat: Add per-feature-view metrics for online read path Jun 3, 2026
…te at startup

Extract sample-rate parsing into a single ParseSampleRate() helper in config.go
and introduce MetricsContext that builds FeatureViewReadMetrics and baseTags once
at server startup. This eliminates repeated env reads and per-request tag
allocations on the hot path in both gRPC and HTTP servers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vanitabhagwat vanitabhagwat force-pushed the feat-per-fv-read-metrics branch from 104b30c to 0bfdf07 Compare June 11, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant